//
//  EditShopPhotoCell.m
//  PigMarket
//
//  Created by 张敬 on 2019/8/14.
//  Copyright © 2019年 pigmarket.oc. All rights reserved.
//

#import "EditShopPhotoCell.h"
#import "CustomImage.h"


@interface EditShopPhotoCell()

@property (nonatomic, strong) CustomImage *photo;



@end

@implementation EditShopPhotoCell


#pragma mark - lifecycle methods

- (void)setupUI
{
    [self addSubview:self.titleLab];
    [self addSubview:self.detailLab];
    [self addSubview:self.photo];

}

- (void)setupLayout
{
    _titleLab.size = CGSizeMake(100, 20);
    _titleLab.mj_x = 15;
    _titleLab.mj_y = 18;
    
    _detailLab.size = CGSizeMake(120, 20);
    _detailLab.mj_x = 100;
    _detailLab.mj_y = 18;
    
    _photo.mj_y = _titleLab.bottom + 12;
    
}


#pragma mark - setter methods
#pragma mark - getter methods

- (UILabel *)titleLab{
    
    if (!_titleLab) {
        _titleLab = [UILabel makeLabelWithText:@"店铺名称" textColor:UIColorFromRGB(0x262626) font:mFont(16) textAliment:0];
    }
    return _titleLab;
}

- (UILabel *)detailLab{
    
    if (!_detailLab) {
        _detailLab = [UILabel makeLabelWithText:@"(仅可上传1张)" textColor:UIColorFromRGB(0x666666) font:mFont(14) textAliment:0];
    }
    return _detailLab;
}


- (CustomImage *)photo{
    if (!_photo) {
        _photo = [[CustomImage alloc] init];
        _photo.size = CGSizeMake(70, 70);
        _photo.mj_x = 15;
        
        kWeakSelf(self);
        _photo.addImageBlock = ^{
            
            if (weakself.addPhotoBlock) {
                weakself.addPhotoBlock();
            }
        };
        
        _photo.cancelImageBlock = ^{
            if (weakself.deletePhotoBlock) {
                weakself.deletePhotoBlock();
            }
        };
    }
    return _photo;
}





@end
